 
/*
 * @Author: ZhouNan
 * @Date: 2022-04-18 22:27:07
 * @LastEditors: ZhouNan
 * @LastEditTime: 2022-04-18 23:52:09
 * @FilePath: \export_ts\src\panels\replace\index.ts
 * @Description: 
 */

import { readFileSync } from 'fs-extra';
import { join } from 'path';
import { createApp, App, ref } from 'vue';
import Replace from './replace';
const weakMap = new WeakMap<any, App>();

module.exports = Editor.Panel.define({
    listeners: {
        
    },
    template: readFileSync(join(__dirname, '../../../src/panels/replace/index.html'), 'utf-8'),
    style: readFileSync(join(__dirname, '../../../src/panels/replace/index.css'), 'utf-8'),
    $: {
        app: '#app',
    },
    methods: {

    },
    ready() {
        const $ = this.$;
        if ($.app) {
            const app = createApp(Replace);
            app.config.compilerOptions.isCustomElement = ((tag) => tag.startsWith('ui-') || tag=='MySelect');
            app.mount($.app);
            weakMap.set(this, app);
        }
    },
    beforeClose() { },
    close() {
        const app = weakMap.get(this);
        if (app) {
            app.unmount();
        }
    },
});